package com.YCH.user.controller.v1;

import com.YCH.apis.user.apis.UserCenterControllerApi;
import com.YCH.model.article.dtos.ArticleInfoDto;
import com.YCH.model.common.dtos.ResponseResult;
import com.YCH.model.user.pojos.TbUser;
import com.YCH.user.service.UserCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/usercenter")
public class UserCenterController implements UserCenterControllerApi {
    @Autowired
    private UserCenterService userCenterService;

    @PostMapping("/load_user_info")
    @Override
    public ResponseResult loadUserInfo() {
        return userCenterService.ObtainUserInfo();
    }

    @PostMapping("/load_user_collection")
    @Override
    public ResponseResult loadUserCollection(@RequestBody ArticleInfoDto dto){
        return userCenterService.ObtainUserCollection(dto);
    }
    @PostMapping("/load_user_comment")
    @Override
    public ResponseResult loadUserComment() {
        return userCenterService.ObtainUserComment();
    }

    @PostMapping("/user_fans")
    @Override
    public ResponseResult loadUserFans() {
        return userCenterService.ObtainUserFans();
    }

    @PostMapping("/user_follow")
    @Override
    public ResponseResult loadUserFollow() {
        return userCenterService.ObtainUserFollow();
    }

    @PostMapping("/user_topic")
    @Override
    public ResponseResult loadUserTopics() {
        return userCenterService.ObtainUserTopics();
    }

    @PostMapping("/update_user_info")
    @Override
    public ResponseResult updateUserInfo(@RequestBody TbUser user) {
        return userCenterService.updateUserInfo(user);
    }

    @GetMapping("/check_nick")
    @Override
    public ResponseResult checkNiceOneOnly(@RequestParam(value = "nick")String nick) {
        return userCenterService.ObtainUserNick(nick);
    }
}
